#!/usr/local/bin/python3
# -*- coding: UTF-8 -*-
"""
@author:apple
@file:demo_struct.py
@time:2021/06/02
"""
import struct


def test():
    ...
    age = 10
    name = 'zhangsan'
    fmt = f'i{len(name)}s'
    print(fmt)
    result = struct.pack(fmt, age, name.encode('utf-8'))
    print(result)
    a1,n1 = struct.unpack(fmt,result)
    print(a1,n1.decode('utf-8'))


def test01():
    ...
    with open('./read_code.py',mode='t') as f:
        ...

if __name__ == '__main__':
    pass
    test()